#include <iostream>
#include "Sales_item.h"

using namespace std;

#if 0
int main(void)
{
    Sales_item item1, item2;

    cin >> item1 >> item2;

    if (item1.isbn() == item2.isbn())
    {
        cout << item1 + item2 << endl;
        return 0;
    }
    else
    {
        cerr << "Data must refer to same ISBN" << endl;
        return -1;
    }
}
#endif

#if 1
int main(void)
{
    Sales_item total;   //
    // 
    if (cin >> total)
    {
        Sales_item trans;   // 
        // 
        while (cin >> trans)
        {
            // 
            if (total.isbn() == trans.isbn())
                total += trans;
            else
            {
                // 
                cout << total << endl;
                total = trans;  // 
            }
            cout << total << endl;
        }
    }
    else
    {
        // 
        cerr << "No data ? !" << endl;
        return -1;
    }
    return 0;
}
#endif
